package innerclass;

/**
 * @author wly
 * @create 2022-12-08 23:52
 */
public class InnerClassExercise01 {
    public static void main(String[] args) {
        new CellPhone().alarmClock(new Bell() {
            @Override
            public void ring() {
                System.out.println("懒猪起床了！");
            }
        });

        new CellPhone().alarmClock(new Bell() {
            @Override
            public void ring() {
                System.out.println("该上课了！");
            }
        });
    }
}


interface Bell{
    void ring();
}

class CellPhone{
    public void alarmClock(Bell bell){
        System.out.println(bell.getClass());
        bell.ring();
    }
}